<?php
include('../resource/config.php'); 
if (isset($_POST['submitted'])) { 
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } 
$sql = "INSERT INTO `regusu` ( `LOUS`, `NAUS` ,  `PASS`  ) VALUES(  '{$_POST['LOUS']}' , '{$_POST['NAUS']}' ,  '{$_POST['PASS']}'  ) "; 
mysql_query($sql) or die( "<script type='text/javascript'>	alert('Problemas al ingresar los datos');window.location = 'listar.php'</script>"); 
echo (mysql_affected_rows()) ?  "<script type='text/javascript'>	alert('Agregado con exito'); window.location = 'listar.php';</script>" : "
<script type='text/javascript'>	alert('Problemas al ingresar los datos'); window.location = 'listar.php';</script>"; 

} 
?>

<div id='crear'>
<form action='' method='POST'> 
<p><b>Usuario:</b><br /><input type='text' name='LOUS' autocomplete="off" required/> 
<p><b>Nombre:</b><br /><input type='text' name='NAUS' autocomplete="off"/> 
<p><b>Clave:</b><br /><input type='password' name='PASS' required/> 
<p><input type='submit' value='Guardar'  class="btn btn-primary"/><input type='hidden' value='1' name='submitted' /> 
</form> 
</div>